home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Demos / A.D. Software / OOFILE / Buildable, limited OOFILE / source / ctree / oofctree.hpp next >
Encoding:
C/C++ Source or Header  |  1996-03-29  |  2.0 KB  |  83 lines  |  [TEXT/CWIE]

  1. #ifndef H_OOFctree
  2. #define H_OOFctree
  3.  
  4. // OOFILE c-tree Plus backend implementation
  5. // EXPORTED header - this is the one included in client programs
  6.  
  7. #include "oof1.hpp"
  8. #include "oof3.hpp"   // non-numeric fields
  9. #include "oof4.hpp"   // numeric fields
  10.  
  11. #ifdef _Macintosh
  12. // Macintosh programmers only, hack to allow setting types
  13. extern long ctMacCreator;
  14. extern long ctMacType;
  15. #endif
  16.  
  17.  
  18. class dbConnect_ctree : public dbConnect {
  19. public:
  20.     enum eLockingStates    {noLocking, readLocking, writeLocking};
  21.  
  22.     dbConnect_ctree() :
  23.                                     mHasBlobs(false),
  24.                                     mUseSuperfile(true),
  25.                                     mLockingState(noLocking),
  26.                                     mReadLockApplications(0),
  27.                                     mWriteLockApplications(0)
  28.     { 
  29.     };
  30.     
  31.     virtual ~dbConnect_ctree();
  32. private:
  33.     dbConnect_ctree(const dbConnect_ctree&) { assert(0); };  // NEVER CALLED
  34.  
  35. public:    
  36.     virtual void newConnection(const char* connectionName);
  37.     virtual void openConnection(const char* connectionName);
  38.     virtual void close();
  39.     
  40.     // special settings specific to this concrete connection
  41.     void useSeparateFiles();
  42.     
  43.     bool isReadLocked() const;
  44.     bool isWriteLocked() const;
  45.     void resetLocks() const;
  46.     
  47. // interchange with OOF_ctreeTableBackend
  48.     void blobsHaveBeenFound();
  49.     long allocBlobFilNo();
  50.     
  51. // locking
  52.     virtual void exitLocking();
  53.     virtual void enterWriteLocking();
  54.     virtual void enterReadLocking();
  55.  
  56.     // utility
  57.     OOF_String makeTableName(const char*) const;
  58.  
  59. private:
  60.     void SetLockingStyle(eLockingStates);
  61.     virtual OOF_tableBackend *MakeTableBackend(dbTable*);
  62.     virtual void SetupConnection(const OOF_String& connectionName);
  63.     void OpenMySpecialTables(const OOF_String& connectionName);
  64.     void CreateMySpecialTables(const OOF_String& connectionName);
  65.     
  66.  
  67.     
  68. // data storage
  69.     bool    mHasBlobs, mUseSuperfile;
  70.     eLockingStates mLockingState;
  71.     int mReadLockApplications, mWriteLockApplications;
  72.     long mSuperFilNo, mBlobFilNo;
  73.     
  74. public:
  75.     static long sFileMode;
  76. };
  77. ostream& operator<<(ostream& os, dbConnect_ctree& connect);
  78.  
  79.  
  80. // include inline definitions
  81. #include "oofctree.inl"
  82.  
  83. #endif